home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1985 September
/
1985-09.d64
/
weather prophet
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2022-09-20
|
13KB
|
351 lines
20 print"[147]":poke53280,1:poke53281,1:poke198,0
30 rem if computer is +4, delete "rem" in line 40
40 rem color 0,2:poke65305,249
50 dimin$(720),ho%(720),mh(12),ml(12),ar(12),as(12),no%(720),d%(50)
60 bl$=" "
70 fort=1to12:readmh(t):next:fort=1to12:readml(t):next
80 fort=1to12:readar(t):next:fort=1to12:readas(t):next
90 fort=1to8:readdi$(t):next
100 open15,8,15:open1,8,2,"rc.index,s,r"
110 input#15,a:ifa=62thengosub240:goto1110
120 input#1,rc%,tr%,hd$,cd$,mp$,ap$,ms$,as$:gosub240:ifrc%=720thenrc%=0
130 goto1110
140 open4,4,7:cmd4:return
150 print#4:close4:return
160 print#15,"p"+chr$(2)+chr$(lb)+chr$(hb)+chr$(1):return
170 hb=int(x1/256):lb=x1-hb*256:return
180 rc$="":fora=1to100:get#1,a$:rc$=rc$+a$:next:return
190 print#15,"i0":return
200 close1:open1,8,2,"wx.data,l,"+chr$(100):return
210 open15,8,15:gosub190:return
220 getg$:ifg$=""then220
230 return
240 close1:close15:return
250 mo=0:print"[147][197]nter number of month for report:";:inputmo
260 yr=0:print"[147][197]nter year for report";:inputyr
270 ifmo<1ormo>12then250
280 print"[147] [215]ait!!"
290 hi=0:lo=200:ba=0:ra=0:sn=0:ws=0:de=0:ed=0:rh=0:bl=33:pc=0
300 print" [208]reparing [210]eport":gosub210:gosub200
310 forx1=1totr%:gosub170:g$="":gosub160
320 fora=1to6:get#1,a$:g$=g$+a$:next
330 ifyr<>val(mid$(g$,5,2))then360
340 ifmo=val(mid$(g$,3,2))thengosub630
350 ifmo<val(mid$(g$,3,2))thenx1=tr%
360 next:close1:gosub190:close15
370 iflo=200thenprint"[147][206]o data for this month exists.":goto620
380 ifpr=1thengosub140
390 print"[147] [205]onthly [210]eport for :[146]";mo;"/"yr
400 print"[206]ormal [200]igh:";mh(mo);:print" [206]ormal [204]ow:"ml(mo)
410 print"[206]ormal [210]ain: "ar(mo);:print" [206]ormal [211]now: "as(mo)
420 print"[200]ighest [194]arometer reading..."ba:
430 print"on "mid$(da$(1),3,2)"/"mid$(da$(1),1,2)"/"mid$(da$(1),5,2)
440 print"[204]owest [194]arometer reading...."bl
450 print"on "mid$(da$(2),3,2)"/"mid$(da$(2),1,2)"/"mid$(da$(2),5,2)
460 print"[200]ighest [212]emperature........."hi
470 print"on "mid$(da$(3),3,2)"/"mid$(da$(3),1,2)"/"mid$(da$(3),5,2)
480 print"[204]owest [212]emperature.........."lo
490 print"on "mid$(da$(4),3,2)"/"mid$(da$(4),1,2)"/"mid$(da$(4),5,2)
500 print"[200]ighest [215]ind "ws" from ";di$(wd)
510 print"on "mid$(da$(5),3,2)"/"mid$(da$(5),1,2)"/"mid$(da$(5),5,2)
520 printpc;"[196]ays with precipitation."
530 print"[205]ost rainfall..............."ra
540 print"on "mid$(da$(6),3,2)"/"mid$(da$(6),1,2)"/"mid$(da$(6),5,2)
550 print"[200]eaviest [211]nowfall..........."sn
560 print"on "mid$(da$(7),3,2)"/"mid$(da$(7),1,2)"/"mid$(da$(7),5,2)
570 print"[200]ighest [200]umidity............"rh
580 print"on "mid$(da$(9),3,2)"/"mid$(da$(9),1,2)"/"mid$(da$(9),5,2)
590 print"[212]otal [200]eating [196]egree [196]ays..."de
600 print"[212]otal [195]ooling [196]egree [196]ays..."ed
610 ifpr=1thengosub150
620 gosub2350:return
630 gosub160:gosub180
640 ifba<val(mid$(rc$,7,5))thenba=val(mid$(rc$,7,5)):da$(1)=mid$(rc$,1,6)
650 ifbl>val(mid$(rc$,7,5))thenbl=val(mid$(rc$,7,5)):da$(2)=mid$(rc$,1,6)
660 ifhi<val(mid$(rc$,13,3))thenhi=val(mid$(rc$,13,3)):da$(3)=mid$(rc$,1,6)
670 iflo>val(mid$(rc$,16,3))thenlo=val(mid$(rc$,16,3)):da$(4)=mid$(rc$,1,6)
680 ifws<val(mid$(rc$,20,3))thenws=val(mid$(rc$,20,3)):wd=val(mid$(rc$,19,1))
690 ifws=val(mid$(rc$,20,3))thenda$(5)=mid$(rc$,1,6)
700 ifra<val(mid$(rc$,23,5))thenra=val(mid$(rc$,23,5)):da$(6)=mid$(rc$,1,6)
710 ifval(mid$(rc$,23,5))<>0thenpc=pc+1
720 ifsn<val(mid$(rc$,28,4))thensn=val(mid$(rc$,28,4)):da$(7)=mid$(rc$,1,6)
730 ifrh<val(mid$(rc$,32,3))thenrh=val(mid$(rc$,32,3)):da$(9)=mid$(rc$,1,6)
740 h=val(mid$(rc$,13,3)):l=val(mid$(rc$,16,3))
750 tp=65-int((h+l)/2):ifsgn(tp)=-1thentp=int((h+l)/2)-65:goto770
760 de=de+tp:goto780
770 ed=ed+tp
780 return
790 print"[147] [211]earching for "mo$"/"da$"/"yr$
800 gosub210:gosub200:r=0:forpt=1totr%:x1=pt:gosub170:rc$=""
810 gosub160:rc$="":fora=1to6:get#1,a$:rc$=rc$+a$:next
820 ifse$=rc$thenr=pt:pt=tr%:rc$=""
830 next
840 ifr=0then870
850 a$="":gosub160:gosub180
860 gosub240:return
870 gosub240:print" [210]ecord not found.":return
880 f=1:print"[147][211]earch by [198][146]ield or [210][146]ecord number?"
890 gosub220:ifg$="r"then1060
900 ifg$<>"f"then890
910 print"[147][197]nter number of field for search:"
920 printtab(7)" 1. [146] [211]pecific [196]ate
930 [153][163]7)" 2. wait chr$enerate (NULL)onthly (NULL)eport
940 printtab(7)" 3. [146] [210]eturn to [205]ain [205]enu
950 [141]220:g[178][198](g$)[171]48:[145]g[137]980,250,970
960 [137]950
970 [142]
980 [153]"load (NULL)earch for str$ate
990 print"[197]nter date (month, day, year)"
1000 print"[211]eparate each entry with a comma.":inputmo$,da$,yr$
1010 ifval(da$)<=9thenda$="0"+da$
1020 ifval(mo$)<=9thenmo$="0"+mo$
1030 ifval(yr$)<=9thenyr$="0"+yr$
1040 se$=da$+mo$+yr$:gosub790:ifr=0thengosub2350:return
1050 gosub2640:gosub2350:return
1060 print"[147]":gosub210:gosub200:rc$=""
1070 print"[210]ecord number for [211]earch?":inputr:ifr>tr%then720
1080 x1=r:gosub170:gosub160:gosub180:gosub190:gosub240:gosub2640:gosub2350
1090 return
1100 gosub240:print"[147][201]nvalid [210]ecord [206]umber":gosub2350:return
1110 print"":printchr$(14):fl=0:f=0:q=fre(o)
1120 print"[147] [215][197][193][212][200][197][210] [208][210][207][208][200][197][212]
1130 [153]" 1 wait valnter (NULL)ew str$ata
1140 print" 2 [146] [198]orecast
1150 [153]" 3 wait (NULL)earch str$ata
1160 print" 4 [146] [196]egree [196]ay [210]egister
1170 [153]" 5 wait valxit (NULL)rogram
1180 print" 0 [146] [212]oggle [208]rinter [207]ption
1190 [153]"":[153]" ";tr%;" (NULL)ecords in str$ata peekase.":[153]""
1200 [139]pr[178]1[167][153]" (NULL)rinter (NULL)(NULL) "
1210 [139]pr[178]0[167][153]" (NULL)rinter (NULL)ascasc "
1220 [141]220:g[178][197](g$):[145]g[141]1270,3000,880,3150,3280
1230 [139]g$[178]"0"[167][141]1250
1240 [137]1110
1250 [139]pr[178]0[167]pr[178]1:[142]
1260 [139]pr[178]1[167]pr[178]0:[142]
1270 [153]"loadvalnter str$ate: (NULL)onth, str$ay, (NULL)ear as 12,31,84"
1280 [153]"(NULL)eparate each entry with a comma.":[133]mo$,da$,yr$
1290 [139][197](da$)[179][178]9[167]da$[178]"0"[170]da$
1300 [139][197](mo$)[179][178]9[167]mo$[178]"0"[170]mo$
1310 [139][197](yr$)[179][178]9[167]yr$[178]"0"[170]yr$
1320 [139]rc%[178]0[167]1370
1330 [141]210:[141]200:x1[178]rc%:[141]170:[141]160
1340 g$[178]"":[129]a[178]1[164]6:[161]#1,a$:g$[178]g$[170]a$:[130]:[141]240
1350 [139][202](g$,3,2)[179]mo$[167]mp$[178]"00":ms$[178]"00"
1360 [139][202](g$,5,2)[179]yr$[167]ap$[178]"00":mp$[178]"00":ms$[178]"00":as$[178]"00"
1370 ba$[178]"":[141]3020:[141]3030
1380 hi$[178]"":[153]"loadvalnter left$igh (NULL)emperature:";:[133]hi$
1390 lo$[178]"":[153]"loadvalnter (NULL)ow (NULL)emperature:";:[133]lo$
1400 [141]3090:ws$[178]"":[153]"loadvalnter atnverage (NULL)ind (NULL)peed":[133]ws$:ws[178][197](ws$)
1410 ra$[178]"":[153]"loadvalnter (NULL)recipitation [0.00] inches.":[133]ra$
1420 mp$[178][196]([197](mp$)[170][197](ra$)):ap$[178][196]([197](ap$)[170][197](ra$))
1430 sn$[178]"":[153]"loadvalnter (NULL)nowfall to nearest tenth inch.":[133]sn$
1440 ms$[178][196]([197](ms$)[170][197](sn$)):as$[178][196]([197](as$)[170][197](sn$))
1450 rh$[178]"":[153]"loadvalnter (NULL)elative left$umidity";:[133]rh$
1460 cc$[178]"":[153]"loadvalnter lenloud lenover (NULL)ercentage";:[133]cc$
1470 wc$[178]"":[153]"loadvalnter comment on current (NULL)x lenonditions:"
1480 [153]"(NULL)imit comments to 40 lenharacters. ((NULL)ne full screen line.)
1490 print" [196]o not use a [195]omma or [195]olon. ":print:inputwc$:print"[147]"
1500 rc$=da$+mo$+yr$+ba$
1510 rc$=rc$+cr$+left$(bl$,1-len(cr$))
1520 rc$=rc$+left$(bl$,3-len(hi$))+hi$
1530 rc$=rc$+left$(bl$,3-len(lo$))+lo$
1540 rc$=rc$+di$+left$(bl$,1-len(di$))
1550 rc$=rc$+left$(bl$,3-len(ws$))+ws$
1560 rc$=rc$+left$(bl$,5-len(ra$))+ra$
1570 rc$=rc$+left$(bl$,4-len(sn$))+sn$
1580 rc$=rc$+left$(bl$,3-len(rh$))+rh$
1590 rc$=rc$+left$(bl$,3-len(cc$))+cc$
1600 rc$=rc$+wc$+left$(bl$,40-l